#include"SmartPtr.h"

namespace syz
{
	struct Date
	{
		int _year;
		int _month;
		int _day;
	};

	void test1()
	{
		auto_ptr<int> sp1(new int(10));
		auto_ptr<int> sp2(new int(5));
		auto_ptr<int> sp3(sp2);

		sp3 = sp1;
		cout << *sp3 << endl;

		auto_ptr<Date> sparray(new(Date));
		sparray->_year = 2024;
		sparray->_month = 5;
		sparray->_day = 11;
	}

	void test2()
	{
		unique_ptr<int> sp1(new int(3));
		unique_ptr<int> sp2(new int(5));
		//unique_ptr<int> sp3(sp1);
		//unique_ptr<int> sp4 = sp2;
	}

	void test3()
	{
		shared_ptr<int> sp1(new int(10));
		shared_ptr<int> sp2(sp1);
		shared_ptr<int> sp3(sp2);
		shared_ptr<int> sp4(sp3);
		cout << sp1.use_count()<<endl;
		cout << sp4.use_count()<<endl;
	}

	void test4()
	{
		shared_ptr<int> sp1(new int(10));
		weak_ptr<int> sp2(sp1);
	}
}

int main()
{
	syz::test3();
}